//
// Created by Administrator on 2022/2/6.
//

#ifndef CPP_LEARNING_LEETCODE1339_H
#define CPP_LEARNING_LEETCODE1339_H
#include "treenode.h"
#include <iostream>
#include <algorithm>
#include <functional>
#include <math.h>
using namespace std;

#define VAL (1000000000 + 7)
class Solution1339 {
public:
    int maxMultipyValue = INT32_MIN;
    /**
     *    返回以自己为根的子树的和
     */
    int postOrder(TreeNode* node){
        if(node == nullptr) return 0;
        int leftSum = postOrder(node->left);
        int rightSum = postOrder(node->right);

        int multiVal1 = (leftSum + node->val) * rightSum;
        int multiVal2 = (rightSum + node->val) * leftSum;

        maxMultipyValue = max(multiVal1, maxMultipyValue);
        maxMultipyValue = max(multiVal2, maxMultipyValue);

        return leftSum + rightSum + node->val;
    }
    int maxProduct(TreeNode* root) {

    }
};
#endif //CPP_LEARNING_LEETCODE1339_H
